﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ZHDJ.Data.Models.JoinParty
{
    public class partyjoinexamination : EntityBase
    {
        public string StandID { get; set; }
        public string AppllicationID { get; set; }

        public string Title { get; set; }

        public string Content { get; set; }

        public DateTime? CreateTime { get; set; }

        public string CreateBy { get; set; }

        public static DataSet GridDataSource(string appllicationID)
        {
            var sql = @"select data.*,om.UserName as CreateUser from tblpartyjoinexamination data 
left JOIN tblpartyorgmember om on `data`.createBy = om.LoginID where data.AppllicationId='" + appllicationID + "'";

            return MySqlHelper.ExecuteDataSet(sql);
        }

        public static DataSet GetRpData(string appllicationID)
        {
            var sql = string.Format(@"select ID,AppllicationID, Title,'JoinStep15' as StepID from tblpartyjoinexamination WHERE AppllicationID='{0}'
UNION
SELECT * from (SELECT StandID as ID,`DATA`.AppllicationID,CONCAT('关于',app.UserName,'同志的',substring(`DATA`.CurrentStepName,4),'证明') as Title,'JoinStep16' as StepID from tblpartyjoinlinkexample DATA
LEFT JOIN tblpartyjoinapplycation app on `DATA`.AppllicationID=app.AppllicationID
where DATA.appllicationID='{0}'  AND CurrentStepID='JoinStep16'   AND DATA.`Status`=1  ORDER BY DATA.CreateTime DESC LIMIT 0,1) t", appllicationID);
            return MySqlHelper.ExecuteDataSet(sql);
        }
    }
}
